package com.yy.controller.user;

import com.yy.controller.service.CategoryService;
import com.yy.dto.CategoryQueryDTO;
import com.yy.entity.Category;
import com.yy.result.PageResult;
import com.yy.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Slf4j
@Api(tags = "用户端分类接口")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 获取所有分类
     * @return
     */
    @GetMapping("/list")
    @CrossOrigin
    @ApiOperation("获取所有启用分类")
    public Result list() {
        List<Category> categoryList = categoryService.list();
        return Result.success(categoryList);
    }
}
